

ngx.log(ngx.DEBUG,'===============start capture===============')
local resp = ngx.location.capture('/proxy/search',{
    method = ngx.HTTP_GET,
    args = {q="hello"}
})

ngx.log(ngx.DEBUG,'===============after capture===============')

if not resp then
		ngx.log(ngx.DEBUG,'===============nil resp===============')
    ngx.say("response error" ,err)
    return
end

-- status, headers, body
ngx.status = resp.status
ngx.log(ngx.DEBUG,'====ngx.status:'.. resp.status)
for k,v in pairs(resp.header) do
		ngx.log(ngx.DEBUG,'======header :' .. k .. v)
    if k ~= "Transfer-Encoding" and k ~= "Connection" then 
        ngx.header[k] = v
    end
end
ngx.say(resp.body)
